package com.mspbots.cw.request;

import com.mspbots.dto.BaseDTO;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * com.mspbots.cw.request.UserTimeLogDTO
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2019/8/16
 */
@Data
public class UserTimeLogDTO implements BaseDTO {

    private Long id;

    private Long tenantId;
    /**
     * tenUserId
     */
    private Long tenantUserId;

    private String teamsUserId;
    /**
     * beginDate
     */
    private LocalDateTime beginDate;
    /**
     * endDate
     */
    private LocalDateTime endDate;
    /**
     * lunchDate
     */
    private LocalDateTime lunchDate;
    /**
     * backLunch
     */
    private LocalDateTime backLunchDate;

    /**
     * every single day
     */
    private LocalDate oneDay = LocalDate.now();

    private LocalDateTime createDate;
    /**
     * format:
     * { "breakMap":[
     * {beginTime: 2019-06-19T05:44:00,endTime: 2019-06-19T05:44:00},
     * {beginTime: 2019-06-19T05:44:00,endTime: 2019-06-19T05:44:00}
     * ]}
     */
    /**
     * online 0 no work,1 working,2 lunch,3 break
     */
    private transient int online = 0;

    private transient String tenantUserName;

    private transient TimeZoneSetupDTO timeZoneSetup;
    /**
     * breakTime ,saved in extend json ,eg: { "breakMap":[{beginTime: 2019-06-19T05:44:00,endTime: 2019-06-19T05:44:00}] }
     * JSON_EXTRACT(extend,'$.breakMap') AS breakMap
     */
    private transient List<Map> breakMap;
    /**
     * sum, (out-in/now)-(backLunchDate-lunchDate) minutes
     * (IFNULL(TIMESTAMPDIFF(MINUTE,begin_date,IFNULL(end_date,now())),0)-IFNULL(TIMESTAMPDIFF(MINUTE,lunch_date,back_lunch_date),0)) AS totalTime
     */
    private transient int totalTime;
}
